package entity;

import java.io.Serializable;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Wink
 */
@Entity
@Table(name = "users")
@XmlRootElement
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "id", unique=true)
    private String id;
    @Id
    @Size(min = 1, max = 20)
    @Column(name = "user_name")
    private String userName;

    public User() {
        this.id = UUID.randomUUID().toString();
    }

    public User(String userName) {
        this.id = UUID.randomUUID().toString();
        this.userName = userName;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
}
